<?php
/*
 * The main template file.
 *
 * @package WordPress
 * @subpackage urbanmeandering
 */

global $posts;
if( is_post_type_archive() )
{
	$archive_title = post_type_archive_title( '', false );
	if( $archive_title == 'Travels and Activities' )
	{
		$slug_title = 'travel';
	}
	elseif( $archive_title == 'Advocacy and Charities' )
	{
		$slug_title = 'advocacy';
	}
	else
	{
		$slug_title = strtolower( $archive_title );
	}
}
else
{
	$slug_title = 'blog';
	$archive_title = 'Blog Archives';
}
	
get_header(); ?>
<div id="main" class="group">
	<?php um_breadcrumbs( $archive_title ); ?>
	<section id="<?php echo sanitize_title( $archive_title ); ?>-posts" class="archive posts-list-overview content">
		<h1 class="page-label"><span class="label"><?php echo $slug_title; ?></span><span class="right">&nbsp;</span></h1>
		<div class="group">
			<?php			
			if( $posts )
			{
				foreach ( $posts as $post )
				{ 
					?>
						<article>
								<a href="<?php echo get_permalink( $post->ID ); ?>"><?php echo get_the_post_thumbnail( $post->ID,'302x170' ); ?></a>
							<div class="text">
								<a href="<?php echo get_permalink( $post->ID ); ?>"><h2 class="entry-title"><?php echo $post->post_title; ?></h2></a>
								<p class="entry-desc"><time datetime="<?php echo $post->post_date; ?>"><?php echo date( get_option( 'date_format' ), strtotime( $post->post_date ) ); ?></time> - <?php echo wp_trim_words( $post->post_excerpt, 15 ); ?></p>						
							</div>
							<span class="comment-count">
									<a href=" <?php comments_link(); ?>"><?php comments_number( 'No comments yet.', '1 Comment', '% Comments' ); ?> </a>
								</span>
						</article>
					<?php 
				} 
			}
			else
			{
				?>
					<p class="no-posts">No posts for <?php echo $archive_title; ?> yet.</p>
				<?php
			}
			?>
		</div>
		<?php 
		if( $posts )
		{
			page_navigation(); 
		} 
		?>
	</section>
	<?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>